<?php
$time=$_GET['time'];
$date=$_GET['date'];
$pass=$_GET['pass'];
$ddh=$_GET['ddh'];
$name=$_GET['name'];
$jine=$_GET['jine'];
$ms=$_GET['ms'];
$mse=$_GET['mse'];

$date1=$_GET['date1'];
$pass1=$_GET['pass1'];
$ddh1=$_GET['ddh1'];
$name1=$_GET['name1'];
$jine1=$_GET['jine1'];
$ms1=$_GET['ms1'];
$mse1=$_GET['mse1'];

function imagettftextSp($image, $size, $angle, $x, $y, $color, $font, $text, $spacing = 0)
{        
    if ($spacing == 0)
    {
        imagettftext($image, $size, $angle, $x, $y, $color, $font, $text);
    }
    else
    {
        $temp_x = $x;
        for ($i = 0; $i < strlen($text); $i++)
        {
            $bbox = imagettftext($image, $size, $angle, $temp_x, $y, $color, $font, $text[$i]);
            $temp_x += $spacing + ($bbox[2] - $bbox[0]);
        }
    }
}



$dst_path = './bg.jpg';//背景图片
//创建图片的实例
$dst = imagecreatefromstring(file_get_contents($dst_path));
//打上文字
$font = './xh.ttf';//字体
$font1= './2.ttf';
$black = imagecolorallocate($dst, 70, 70, 70);//字体颜色黑
$hui = imagecolorallocate($dst, 145, 145, 145);//字体颜色灰
$bai = imagecolorallocate($dst, 255, 255, 255);//字体颜色白
imagefttext($dst, 18, 0, 315, 28, $bai, $font, $time);
imagefttext($dst, 20, 0, 50, 252, $hui, $font, $date);
imagefttext($dst, 20, 0, 51, 252, $hui, $font, $date);
imagefttext($dst, 20, 0, 190, 420, $black, $font, $pass);
imagefttext($dst, 20, 0, 191, 420, $black, $font, $pass);
imagefttext($dst, 20, 0, 165, 314, $black, $font, $ddh);
imagefttext($dst, 20, 0, 166, 314, $black, $font, $ddh);
imagefttext($dst, 20, 0, 160, 385, $black, $font, $name);
imagefttext($dst, 20, 0, 161, 385, $black, $font, $name);
imagefttext($dst, 20, 0, 240, 460, $black, $font, $jine);
imagefttext($dst, 20, 0, 241, 460, $black, $font, $jine);
//输出图片
imagettftextSp($dst, 20, 0, 50, 515, $black, $font, $ms);
imagettftextSp($dst, 20, 0, 51, 515, $black, $font, $ms);
imagettftextSp($dst, 20, 0, 50, 545, $black, $font, $mse);
imagettftextSp($dst, 20, 0, 51, 545, $black, $font, $mse);


imagefttext($dst, 20, 0, 50, 772, $hui, $font, $date1);
imagefttext($dst, 20, 0, 51, 772, $hui, $font, $date1);
imagefttext($dst, 20, 0, 190, 945, $black, $font, $pass1);
imagefttext($dst, 20, 0, 191, 945, $black, $font, $pass1);
imagefttext($dst, 20, 0, 165, 834, $black, $font, $ddh1);
imagefttext($dst, 20, 0, 166, 834, $black, $font, $ddh1);
imagefttext($dst, 20, 0, 160, 910, $black, $font, $name1);
imagefttext($dst, 20, 0, 161, 910, $black, $font, $name1);
imagefttext($dst, 20, 0, 240, 985, $black, $font, $jine1);
imagefttext($dst, 20, 0, 241, 985, $black, $font, $jine1);
//输出图片
imagettftextSp($dst, 20, 0, 50, 1040, $black, $font, $ms1);
imagettftextSp($dst, 20, 0, 51, 1040, $black, $font, $ms1);
imagettftextSp($dst, 20, 0, 50, 1070, $black, $font, $mse1);
imagettftextSp($dst, 20, 0, 51, 1070, $black, $font, $mse1);

list($dst_w, $dst_h, $dst_type) = getimagesize($dst_path);
switch ($dst_type) {
    case 1://GIF
        header('Content-Type: image/gif');
        imagegif($dst);
        break;
    case 2://JPG
        header('Content-Type: image/jpeg');
        imagejpeg($dst);
        break;
    case 3://PNG
        header('Content-Type: image/png');
        imagepng($dst);
        break;
    default:
        break;
}


?>